#ifndef CLICKEDLABEL_H
#define CLICKEDLABEL_H

#include <QLabel>

#include "netglobal.h"

//实现可以点击的标签
class ClickedLabel : public QLabel
{
    Q_OBJECT
public:
    ClickedLabel(QWidget *parent=nullptr);

    // 处理鼠标点击事件
    void mousePressEvent(QMouseEvent* e) override;

    // 处理鼠标悬停进入事件
    void enterEvent(QEnterEvent *event) override;

    // 处理鼠标悬停离开事件
    void leaveEvent(QEvent *event) override;

    //设置状态
    void SetState(QString normal="", QString hover="", QString press="",
                  QString select="", QString select_hover="", QString select_press="");

    //返回当前状态
    ClickLbState GetCurState();

private:
    //密码可见
    QString _normal;       //正常
    QString _normal_hover; //悬停
    QString _normal_press; //按下

    //密码不可见
    QString _selected;     //选中
    QString _selected_hover;
    QString _selected_press;

    ClickLbState _curstate;
signals:
    void clicked(void);
};

#endif // CLICKEDLABEL_H
